package com.example;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class HeaderConfig {

    @Bean
    //@ConditionalOnMissingBean(name = "empController")
    //@ConditionalOnBean(name = "empController")
    // 当环境中有一个配置项叫做upload.type，值是aliyun
    @ConditionalOnProperty(name ="upload.type",havingValue = "aliyun")
    public HeaderParser headerParser(){
        return new HeaderParser();
    }

    @Bean
    public HeaderGenerator headerGenerator(){
        return new HeaderGenerator();
    }

    @Bean
    // @ConditionalOnClass(name="io.jsonwebtoken.Jwts")
    @ConditionalOnProperty(name ="upload.type",havingValue = "qiniu")
    public TokenParser tokenParser(){
        return new TokenParser();
    }
}
